const mysql = require('mysql');
//创建数据库链接
let pool = mysql.createConnection({
    host:'192.168.174.166',
    user:"root",
    password:'ddd',
    database:'abc'
})

module.exports = {
    query:(sql,args=[])=>{
        let p1 = new Promise((resolve,reject)=>{
        pool.query(sql,[...args],(err,results,fields)=>{
            if(err){
                reject(err);
            }
            else{
                resolve(results);
            }
        })
    })
        return p1;
    }
}